﻿<Window x:Class="CodeBuilder2.MainWnd"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="SimpleCodeBuilder" Height="600" Width="800" WindowState="Maximized" Loaded="Window_Loaded">
    <Window.Resources>
        <Style TargetType="Button">
            <Setter Property="Background" Value="yellow"/>
            <Setter Property="LayoutTransform">
                <Setter.Value>
                    <RotateTransform Angle="45"/>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>
    <Canvas Name="baseCanvas">
        <DockPanel Background="#FF2B3562" Width="{Binding ElementName=baseCanvas, Path=ActualWidth}" Height="{Binding ElementName=baseCanvas, Path=ActualHeight}">
            <!--菜单栏 + 工具栏-->
            <StackPanel DockPanel.Dock="Top">
                <Menu>
                    <MenuItem Header="文件">
                        <MenuItem Header="新建" />
                        <MenuItem Header="打开..." />
                        <Separator />
                        <MenuItem Header="退出" />
                    </MenuItem>
                    <MenuItem Header="编辑">
                        <MenuItem Header="撤销" />
                        <MenuItem Header="重做" />
                    </MenuItem>
                    <MenuItem Header="生成">
                        <MenuItem Header="生成选中..." />
                    </MenuItem>
                    <MenuItem Header="帮助">
                        <MenuItem Header="查看帮助" />
                        <Separator />
                        <MenuItem Header="关于" />
                    </MenuItem>
                </Menu>
                <ToolBarTray>
                    <ToolBar Band="0" BandIndex="0">
                        <Button>
                            新建连接
                        </Button>
                    </ToolBar>
                    <ToolBar Band="0" BandIndex="1">
                        <Button>
                            生成实体类
                        </Button>
                        <Separator/>
                        <Button>
                            生成存储过程
                        </Button>
                    </ToolBar>
                    <ToolBar Band="0" BandIndex="2">
                        <Button Name="btnCreateSQL" Click="btnCreateSQL_Click">
                            新建 SQL 脚本
                        </Button>
                        <Button Name="btnExecuteSQL" Click="btnExecuteSQL_Click">
                            运行所选 SQL 脚本
                        </Button>
                        <Separator/>
                        <Button>
                            新建 C# 代码
                        </Button>
                        <Button>
                            运行 C# 代码
                        </Button>
                    </ToolBar>
                </ToolBarTray>
            </StackPanel>
            <!--状态栏-->
            <StatusBar VerticalAlignment="Bottom" DockPanel.Dock="Bottom">
                <StatusBarItem Content="状态栏" />
            </StatusBar>
            <!--主操作区-->
            <Grid Panel.ZIndex="11" Margin="0,5,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <!--左边-->
                <Grid Panel.ZIndex="4" Grid.RowSpan="2" Background="#FFF4C2C2">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <!--这个 StackPanel 是用来容纳当 Dock 模式为自动隐藏时的纵向按钮（选项卡）-->
                    <StackPanel>
                        <Button Padding="3" MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave" Name="btnDatabase" Content="数据库">
                            <Button.LayoutTransform>
                                <RotateTransform Angle="90"/>
                            </Button.LayoutTransform>
                        </Button>
                        <Button Padding="3" MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave" Name="btnExplorer" Content="资源管理器">
                            <Button.LayoutTransform>
                                <RotateTransform Angle="90"/>
                            </Button.LayoutTransform>
                        </Button>
                    </StackPanel>
                    <!--这个 Canvas 是用来容纳当鼠标悬停在或者点击了某个上述按钮时将要显示的内容-->
                    <Canvas Panel.ZIndex="4" Grid.Column="1" MinWidth="5" Name="cnvsContainer">
                        <DockPanel  Name="dpContainer"  Height="{Binding ElementName=cnvsContainer, Path=ActualHeight }">

                        </DockPanel>
                    </Canvas>
                </Grid>
                <!--中间-->
                <DockPanel Grid.Column="2" Background="#FFDEFAB7" Panel.ZIndex="1">
                    <!--<TextBlock>中部（填充区）</TextBlock>
                    <TextBlock Panel.ZIndex="3000">中部（填充区）asdfasdfasdfasdf</TextBlock>-->
                    <TabControl Name="tcMain" DockPanel.Dock="Top">
                    </TabControl>
                    <!--<Grid>                        
                        <Grid.RowDefinitions>
                            <RowDefinition Height="200" />
                            <RowDefinition Height="auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <TextBox Grid.Row="0" Text="hahaahaha"/>
                        <GridSplitter Background="Red" Grid.Row="1" Grid.Column="0" Height="18" HorizontalAlignment="Stretch" />
                        <TextBox Text="hehehehehe" Grid.Row="2"/>
                    </Grid>-->
                </DockPanel>
                <!--右边-->
                <Grid Grid.Column="4" Grid.RowSpan="3" HorizontalAlignment="Right" Background="#FFF2D2FC" Panel.ZIndex="2">
                    <TextBlock>右侧</TextBlock>
                    <Button Height="40" Width="150" Content="RotateTransform Applied" Click="Button_Click">
                        <Button.LayoutTransform>
                            <RotateTransform CenterX="25" CenterY="25" Angle="90" />
                        </Button.LayoutTransform>
                    </Button>
                </Grid>
                <!--下边-->
                <Grid Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="3" VerticalAlignment="Bottom" Panel.ZIndex="3">
                    <TextBlock Background="#FFADEAFF">底部</TextBlock>
                </Grid>
            </Grid>
        </DockPanel>
    </Canvas>
</Window>
